/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.oa.service;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.oa.dao.CarAnalyzeDao;
import com.thinkgem.jeesite.modules.oa.entity.CarAnalyzeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 通知通告Service
 *
 * @author ThinkGem
 * @version 2014-05-16
 */
@Service
@Transactional(readOnly = true)
public class CarAnalyzeService extends CrudService<CarAnalyzeDao, CarAnalyzeVo> {

    @Autowired
    private CarAnalyzeDao carAnalyzeDao;

    public CarAnalyzeVo get(String id) {
        CarAnalyzeVo entity = carAnalyzeDao.get(id);
        return entity;
    }


    public Page<CarAnalyzeVo> find(Page<CarAnalyzeVo> page, CarAnalyzeVo carAnalyzeVo) {
        carAnalyzeVo.setPage(page);

        List<CarAnalyzeVo> list = carAnalyzeDao.findList(carAnalyzeVo);
        for (CarAnalyzeVo vo : list) {
            vo.setRn(vo.getRn() + (page.getPageNo() - 1) * page.getPageSize());
        }
        page.setList(list);
        return page;
    }

    /**
     * 获取通知数目
     *
     * @param carAnalyzeVo
     * @return
     */
    public Long findCount(CarAnalyzeVo carAnalyzeVo) {
        return carAnalyzeDao.findCount(carAnalyzeVo);
    }

}